package com.freedy.concurrent.JMM.pattrens;

/**
 * @author Freedy
 * @date 2021/4/23 17:43
 */
public class SingleTon {
    private SingleTon(){}

    private static volatile SingleTon INSTANCE=null;

    public static SingleTon getInstance(){
        if (INSTANCE==null){
            synchronized (SingleTon.class){
                if (INSTANCE==null){
                    INSTANCE= new SingleTon();
                }
            }
        }
        return INSTANCE;
    }

    public Object readResolve(){
        return INSTANCE;
    }

}
